define(function (require, exports, module) {
    var angular = require('angular');
    var api_prefix = G_CONFIG["api_prefix"]; //api前缀
    var ui = require("ui");
    var util = require("util");
    require("pagination");
    require("angular-ui");
    require("/public/js/myservice/contract/editinc/receivable-refund-ctrl");
    var config = require('/public/js/myservice/config');

    angular.module('Refund', ['ngUI', 'ContractReceivableRefund'])
        .controller('refundCtl', ['$scope', 'appservice', 'contractCommonService', function ($scope, appservice, contractCommonService) {
            appservice.name = '明源云链-待录入回款';

            contractCommonService.getAccountHkList('', function (data) {
                $scope.importPayments = data;
                $scope.isloading = false;
                $scope.$applyAsync();
            }, function () {
                $scope.isloading = false;
                $scope.$applyAsync();
            });
            $scope.search = function (key) {
                $scope.isloading = true;
                contractCommonService.getAccountHkList(key, function (data) {
                    $scope.importPayments = data;
                    $scope.isloading = false;
                    $scope.$applyAsync();
                }, function () {
                    $scope.isloading = false;
                    $scope.$applyAsync();
                });
            };
            $scope.export = function(){
                util.confirm('确定要导出数据吗？',{
                    ok:function(){
                        var url = api_prefix + "/erp-interface/export-refund";
                        var data = $scope.exportData;
                        util.download(url,data);
                    }
                });
            };
            $scope.editRemark = function(content){
                util.showDialog({
                    id: "__refund_modify_remark__",
                    title: '修改备注',
                    content: '<textarea type="text" class="form-control ng-pristine ng-valid ng-touched" id="remark" placeholder="备注" rows="4">'+content+'</textarea>',
                    width: 350,
                    okValue: '确定',
                    ok: function () {
                        //location.href = '/';
                        return true;
                    },
                    cancel: function () {
                        return true;
                    }
                })
            }
        }]);
});